Template.channel_info_panel.onCreated(function() {
  this.openUpdatePanel = new ReactiveVar(false);
});

Template.channel_info_panel.onRendered(function() {
  const ps = new PerfectScrollbar('#channel-info-panel-content');
});

Template.channel_info_panel.helpers({
  openUpdatePanel: function() {
    return Template.instance().openUpdatePanel.get();
  },
  apply: function(policy) {
    if (policy && policy.name == 'public' && policy.apply) {
      return '需要申请加入';
    }
    if (policy && policy.name == 'public' && !policy.apply) {
      return '不需申请加入';
    }
    if (policy && policy.name == 'private' && policy.apply) {
      return '可以申请加入';
    }
    if (policy && policy.name == 'private' && !policy.apply) {
      return '不允许申请加入';
    }
  },
  members: function(members) {
    if (!members) {
      return '没有加入者';
    }
  }
});

Template.channel_info_panel.events({
  'click #open-update-panel' (e, instance) {
    instance.openUpdatePanel.set(true);
  },
  
});